package com.insyte.fragments;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.insyte.R;
import com.insyte.activities.ResultSearchActivity;
import com.insyte.config.Constants;
import com.insyte.config.InsyteApp;
import com.insyte.model.User;

import java.util.HashMap;
import java.util.Map;

public class FindUserFragment extends Fragment implements View.OnClickListener{
    View v;
    private RelativeLayout btn_insyte_community, btn_face, btn_contacts, btn_email;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,  Bundle savedInstanceState) {
        v = inflater.inflate(R.layout.fragment_find_user, container, false);
        getViewController(v);
        setEvent();
        return v;
    }

    private void getViewController(View v) {
        btn_insyte_community = (RelativeLayout) v.findViewById(R.id.btn_insyte_community);
        btn_face = (RelativeLayout) v.findViewById(R.id.btn_face);
        btn_contacts = (RelativeLayout) v.findViewById(R.id.btn_contacts);
        btn_email = (RelativeLayout) v.findViewById(R.id.btn_email);
    }

    private void setEvent() {
        btn_insyte_community.setOnClickListener(this);
        btn_contacts.setOnClickListener(this);
        btn_email.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        Intent intent = new Intent(getActivity(), ResultSearchActivity.class);

        switch (view.getId()){
            case R.id.btn_insyte_community:
                intent.putExtra("find_type", "community");
                break;
            case R.id.btn_contacts:
                intent.putExtra("find_type", "contacts");
                break;
            case R.id.btn_email:
                intent.putExtra("find_type", "email");
                break;
        }

        getActivity().startActivity(intent);

    }
}
